home *** CD-ROM | disk | FTP | other *** search
/ PC Format (UK) 188 / 01-04 PC Format 188 [2006-06] DVD side 1_.iso / DiscContents / Workshops / Workshops_Games / Gamer's Internet Tunnel / Git-099b4.exe / {app} / Warcraft II.git < prev    next >
Text File  |  2004-10-03  |  6KB  |  175 lines

  1. # GIT Wizard script for Warcraft II
  2.  
  3. # It doesn't really matter if you are client or server
  4. # Just that there is only one GIT per LAN
  5. # But it's still better to re-use this wizard page
  6.  
  7. # Standard Page about Client/Server
  8. loadvar clisrv
  9. setvar heading "Client or Server"
  10. setvar subheading "Please select if you are hosting or joining the game below."
  11. addline control "radio|clisrv|Please select one:|"
  12. appendstring control "|First Remote Client on my LAN"
  13. appendstring control "|Another Remote Client on my LAN"
  14. appendstring control "|Local Client"
  15. appendstring control "|The Server"
  16. addline control "space|||2"
  17. addline control "label||Select 'First Remote Client on my LAN' if the server hosted someplace else and you are the first or only client on your LAN."
  18. appendstring control " Only one person per LAN should select this option, the rest must select 'Another Remote Client on my LAN'."
  19. appendstring control " If the server is local on your own LAN, but not on your computer, select 'Local Client'."
  20. appendstring control " If you are the server, select 'The Server'.|5"
  21. showpage
  22. savevar clisrv
  23.  
  24. # No need for GIT if another remote client
  25. if clisrv = 1
  26.     cancel "You do not need to run GIT as another remote client.  Only the first remote client needs to run GIT and you will be able to find the server."
  27. endif
  28.  
  29. # No need for GIT if local client
  30. if clisrv = 2
  31.     cancel "You do not need to run GIT as a local client. You should be able to see the game server using the normal method."
  32. endif
  33.  
  34. # Basic common settings
  35. setvar sockets "87c2 : Warcraft II"
  36. setvar ports ""
  37. setvar options OPT_FRAME_8022
  38. addflag options OPT_FRAME_8023
  39. setvar packets PACKET_IPX
  40. setvar protos 0
  41.  
  42. # Standard Network Configuration page
  43. loadvar hostname
  44. loadvar firewall
  45. loadvar nat
  46. loadvar externalhostname
  47. setvar heading "Network Configuration"
  48. setvar subheading "Please enter your IP address information below."
  49. addline control "label||What is your hostname or IP address?"
  50. addline control "text1|hostname||4"
  51. addline control "label||Are you open to receive incoming connections or are you firewalled?"
  52. addline control "radio|firewall||4|Open|Firewalled"
  53. addline control "label||Do you have a direct connection to the Internet or are you using NAT?"
  54. addline control "radio|nat||4|Direct Connection|NAT"
  55. addline control "label||If you are using NAT, what is your external hostname or IP address?"
  56. addline control "text1|externalhostname||4"
  57. addline control "space|||3"
  58. addline control "specl||ipfwnat";
  59. showpage
  60. savevar hostname
  61. savevar firewall
  62. savevar nat
  63. savevar externalhostname
  64.  
  65. # Page Providing IP + Ask for a list of all others
  66. loadvar servhostlist
  67. if nat = 0
  68.     setvar myhost hostname
  69. else
  70.     setvar myhost externalhostname
  71. endif
  72. if servhostlist !con myhost
  73.     addline servhostlist myhost
  74. endif
  75. removeblanklines servhostlist
  76. sortlines servhostlist
  77. setvar heading "Host/IP List"
  78. setvar subheading "Information to provide to other LANs."
  79. addline control "label||Reminder: Your external hostname or IP is:"
  80. addline control "textr|myhost||4"
  81. addline control "label||You must provide this information to the person running GIT on each LAN now."
  82. addline control "space|||2"
  83. addline control "textm|servhostlist|Enter the hostname or IP each other person provides, one per line, including your own:|8"
  84. addline control "label||Everybody running GIT must have the all of the same hostnames or IPs listed here."
  85. showpage
  86. removeblanklines servhostlist
  87. sortlines servhostlist
  88. savevar servhostlist
  89.  
  90. # Must have at least two listed
  91. numlines numhosts servhostlist 
  92. if numhosts < 2
  93.     cancel "You must list at least your own host and one other."
  94. endif
  95.  
  96. # Figure out where in the list of hosts is ourself
  97. setvar myhostnum -1
  98. setvar i 0
  99. while i < numhosts
  100.     getline host servhostlist i
  101.     if host = myhost
  102.         setvar myhostnum i
  103.     endif
  104.     math i i + 1
  105. endwhile
  106.  
  107. # Make sure they listed themselves
  108. if myhostnum < 0
  109.     cancel "Your own hostname or IP was not found in the list."
  110. endif
  111.  
  112. # Loop through all the hosts and assign a port to each combination
  113. # Save all the ports/connections that involve ourself
  114. setvar port 213
  115. setvar hosts ""
  116. setvar portlist ""
  117. setvar i 0
  118. while i < numhosts
  119.     setvar j i
  120.     math j j + 1
  121.     while j < numhosts
  122.         setvar host ""
  123.         if i = myhostnum
  124.             getline host servhostlist j
  125.         endif
  126.         if j = myhostnum
  127.             getline host servhostlist i
  128.         endif
  129.         if host != ""
  130.             appendstring host ":"
  131.             appendstring host port
  132.             appendstring host METH_UDP
  133.             addline hosts host
  134.             addline portlist port
  135.         endif
  136.         math j j + 1
  137.         math port port + 1
  138.     endwhile
  139.     math i i + 1
  140. endwhile
  141.  
  142. # If firewalled, show a reminder page listing ports
  143. # NAT with no firewall implies DMZ, so the port should be open
  144. if firewall != 0
  145.  
  146.     setvar heading "Reminder"
  147.     setvar subheading "Ports to map"
  148.  
  149.     # Create a nice string out of the list of ports
  150.     removeblanklines portlist
  151.     numlines i portlist
  152.     if i > 1
  153.         math i i - 1
  154.         getline port portlist i
  155.         prependstring port "and "
  156.         setline portlist i port
  157.     endif
  158.     joinlines portlist ", "
  159.  
  160.     if nat != 0
  161.         addline control "label||Reminder: Since you are using NAT, you must map port "
  162.         appendstring control portlist
  163.         appendstring control " from "
  164.         appendstring control externalhostname
  165.         appendstring control " to "
  166.         appendstring control hostname
  167.         appendstring control "|2"
  168.     else
  169.         addline control "label||Reminder: Since you are firewalled, you must be able to open access to incoming connections on port "
  170.         appendstring control portlist
  171.         appendstring control ".|2"
  172.     endif
  173.     showpage
  174. endif
  175.